/**
 * 
 */
package com.curso.sesion10;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author Peter
 *
 */
public class SerializeDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Employee e = new Employee ();
		e.name = "Peter Suarze";
		e.address = "Calle 57Z # 77 C 60";
		e.SSN = 1024515113;
		e.number = 316302;
		FileOutputStream fileOut = null;
		ObjectOutputStream out=null;
		
		try {
			 fileOut = new FileOutputStream ("D:\\programacion\\Employee.txt");
			 out = new ObjectOutputStream (fileOut);
			out.writeObject(e);
			out.close();
			fileOut.close();
			
		}catch (IOException i){
			i.printStackTrace();
		}finally {
			try {
				if (out != null){
					out.close();
					
					out.flush();
				}
				if (fileOut != null){
					fileOut.close();
				}
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
				
	}

}
